package com.itbbfx.controller.warehourse;

import com.itbbfx.service.*;
import com.itbbfx.service.warehourse.BaoqueService;
import com.itbbfx.service.warehourse.DrugstoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/dsnavigation")
public class WarehouseViewController {
    @Autowired
    private SupplierService supplierService;
    @Autowired
    private SkullService skullService;
    @Autowired
    private WarehouseService warehouseService;
    @Autowired
    private BaoqueService baoqueService;
    @Autowired
    private DrugstoreService drugstoreService;

    /**
     * 入库
     *
     * @return
     */
    @RequestMapping("/beputinstorage")
    public String beputinstorage(Model model) {
        model.addAttribute("selupp", supplierService.queryAll());
        model.addAttribute("selsku", skullService.queryAll());
        model.addAttribute("selwar", warehouseService.queryAll());
        return "WarehouseManager/c_beputinstorage";
    }

    /**
     * 出库
     *
     * @return
     */
    @RequestMapping("/selectchuku")
    public String selectchuku(Model model) {
        model.addAttribute("selbaoquecount",baoqueService.queryAll(null).size());
        return "WarehouseManager/c_gooutstore";
    }

    /**
     * 操作记录
     *
     * @return
     */
    @RequestMapping("/record")
    public String record() {
        return "WarehouseManager/c_record";
    }

    /**
     * 过期提醒
     *
     * @return
     */
    @RequestMapping("/seldrugDate")
    public String seldrugDate(Model model) {
        model.addAttribute("selcountlessnum",drugstoreService.queryOverdueCount());
        return "WarehouseManager/c_storedrugDate";
    }

    /*
     * 跳转加载warehuose.html
     * */
    @RequestMapping("toWarehuose")
    public String toWarehuose() {
        return "WarehouseManager/warehouse";
    }
    /*
     * 跳转加载skull.html
     * */
    @RequestMapping("toSkull")
    public String toSkull() {
        return "WarehouseManager/skull";
    }
    /*
     * 跳转加载supply.html
     * */
    @RequestMapping("toSupply")
    public String toSupply() {
        return "WarehouseManager/supply";
    }
    //进入库房查询
    @RequestMapping("toDrugRecycling")
    public Object toDrugRecycling(){
        return "WarehouseManager/recycle";
    }

    @RequestMapping("toArea")
    public String toArea() {
        return "WarehouseManager/area";
    }
    //跳转药品字典模块
    @RequestMapping("toDrugdictionary")
    public String toDrugdictionary(){
        return "WarehouseManager/drugdictionary";
    }
    //库房药品查询
    @RequestMapping("selectdurg")
    public Object selectdurg() {
        return "WarehouseManager/c_selectDrug";
    }
    //进入药品报缺
    @RequestMapping("selectless")
    public Object selectless(Model model) {
        return "WarehouseManager/c_lackdrug";
    }
}